// import request from 'umi-request';
import request from '@/utils/request';
export async function queryRule(params) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
  };
  Object.assign(params, my_params);
  return request('/factory/terminal/model/page', {
    params,
  });
}
export async function queryHardWarRule(params) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
  };
  Object.assign(params, my_params);
  return request('/factory/terminal/hardware/page', {
    params,
  });
}

export async function queryBindHardWarRule(params) {
  return request('/factory/terminal/model/hardwares', {
    params,
  });
}

export async function removeRule(payload) {
  return request(`/factory/terminal/model/${payload}`, {
    method: 'DELETE',
  });
}
export async function addRule(params) {
  return request('/factory/terminal/model', {
    method: 'POST',
    data: { ...params },
  });
}
export async function updateRule(params) {
  return request('/factory/terminal/model', {
    method: 'PUT',
    data: { ...params },
  });
}
export async function updateModelRule(params) {
  return request('/factory/terminal/model/build', {
    method: 'PUT',
    data: params,
  });
}
